/* 全局样式 */
html, body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: #121212;
    color: #ffffff;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* 容器 */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-right 0.3s ease;
}

/* 当侧边栏打开时，内容区域的右边距调整 */
.app-container.sidebar-open {
    margin-right: 350px;
}

/* 头部 */
header {
    background-color: #1f1f1f;
    padding: 1rem;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
}

header::after {
    content: '';
    background: url('/static/header-bg.jpg') center/cover no-repeat;
    opacity: 0.2;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    position: absolute;
    z-index: -1;
}


/* 侧边栏展开按钮样式 */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
}

.sidebar-toggle:hover {
    color: #03dac6;
}

/* 侧边栏的基础样式 */
#player-section {
    position: fixed;
    top: 0;
    left: -60%; /* 初始位置在视口外的左侧 */
    width: 60%; /* 大屏幕下，侧边栏宽度为 60% */
    height: 100%;
    background-color: #1e1e1e;
    overflow-y: hidden;
    transition: left 0.3s ease;
    z-index: 1000;

    display: flex;
    flex-direction: column;
}

/* 侧边栏打开时的样式 */
#player-section.active {
    left: 0;
}

/* 侧边栏关闭按钮 */
#player-section .close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
}

#player-section .close-button:hover {
    color: #03dac6;
}


/* 遮罩层样式 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 900;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* 主体 */
main {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: linear-gradient(to bottom, #1f1f1f, #121212);
}

/* 搜索部分 */
#search-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

.search-container {
    display: flex;
    width: 100%;
    max-width: 600px;
}

#search-input {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 25px 0 0 25px;
    background-color: #2b2b2b;
    color: #ffffff;
    font-size: 1rem;
}

#search-input::placeholder {
    color: #bbbbbb;
}

#search-button {
    padding: 0 1rem;
    border: none;
    border-radius: 0 25px 25px 0;
    background-color: #6200ee;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
}

#search-button:hover {
    background-color: #7e57c2;
}

.error-message {
    color: #cf6679;
    text-align: center;
    margin-top: 1rem;
}

/* 搜索结果 */
.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.song-item {
    background-color: #1e1e1e;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    text-align: center;
}

.song-item:hover {
    transform: scale(1.05);
}

.song-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.song-item p {
    color: #bbbbbb;
}


/* 播放器容器 */
.player-container {
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 专辑封面 */
.album-art img {
    width: 100%;
    max-width: 250px;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* 播放器信息 */
.player-info {
    width: 80%;
    text-align: center;
    margin-top: 1rem;
}

.player-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.player-info p {
    color: #bbbbbb;
    margin-bottom: 1rem;
}

/* 播放器控制按钮样式 */
.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
}

.control-button {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    margin: 0 1rem;
    cursor: pointer;
}

.control-button:hover {
    color: #03dac6;
}

/* 隐藏 audio 元素 */
#audio-player {
    display: none;
}

/* 进度条和时间显示 */
.progress-container {
    display: flex;
    align-items: center;
    width: 100%;
    margin-top: 1rem;
    padding: 0 1rem;
    box-sizing: border-box;
}

#current-time, #duration {
    color: #ffffff;
    font-size: 0.9rem;
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}

#progress-bar {
    flex-grow: 1;
    margin: 0 10px;
    cursor: pointer;
    max-width: 80%;
}

#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #ffffff;
    cursor: pointer;
    border-radius: 50%;
}

#progress-bar::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #555;
    border-radius: 2px;
}

#progress-bar:focus {
    outline: none;
}


/* 歌词容器 */
.lyrics-container {
    margin-top: 1rem;
    flex-grow: 1;
    overflow: hidden;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 1rem;
}

/* 歌词内容 */
.lyrics {
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

/* 每行歌词 */
.lyrics p {
    margin: 0.5rem 0;
    text-align: center;
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
}

/* 当前播放的歌词 */
.current-line {
    opacity: 1;
    font-weight: bold;
    color: #03dac6;
    font-size: 1.2rem;
}

/* 底部 */
footer {
    background-color: #1f1f1f;
    color: #bbbbbb;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

/* 响应式 */
@media (max-width: 768px) {
    #player-section {
        width: 80%; /* 小屏幕下，侧边栏宽度为 80% */
        left: -80%; /* 初始位置在视口外的左侧 */
    }

    #player-section.active {
        left: 0;
    }

    /* 调整专辑封面大小 */
    .album-art img {
        max-width: 200px;
    }
}
